#!/usr/bin/env bash

cd $(dirname $0)

JSON_FORMAT=$(cat <<EOF

import sys
import json
str=''
for line in sys.stdin:
    str+=line
print(json.dumps(json.loads(str), ensure_ascii=False, indent=4, sort_keys=True))

EOF
)

ADDRESS='10.64.56.214:8888'
#ADDRESS='localhost:8080'
#ADDRESS='hot.hupu.com:80'
#ADDRESS='hot2.hupu.com:80'

paras=$(cat <<'EOF'
{
    "cid": 99999900,
    "fids": [ ],
    "read_xids": [ ]
}
EOF
)

cmd="curl -H 'content-type: application/json;charset=UTF-8' -X POST -d '$paras' $ADDRESS/recmd/fetchhotlist"
echo $cmd
eval $cmd | python3 -c "$JSON_FORMAT"
